home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr25 / mr2_143.zip / MSG2REP.CMD < prev    next >
OS/2 REXX Batch file  |  1993-06-05  |  3KB  |  87 lines

  1. /*
  2.     MR/2 - MSG2REP.CMD
  3.  
  4.     Author:     Nick Knight
  5.     Created:    03/26/93
  6.     Usage:        msg2rep packet.rep packet.msg
  7.     Purpose:
  8.  
  9.     The author claims no copyright to this particular REXX script.
  10.     Feel free to copy it and/or use it for other purposes.  I *would*
  11.     like to see the results of any improvements to it.
  12.  
  13.     US Mail:    Nick Knight, 1823 David Ave.,  Parma, Ohio 44134
  14.     Fidonet:    1:157/2 or 1:/157/200
  15.     Internet:    nick.knight@pcohio.com
  16.     Compuserve: 76066,1240
  17.     BBS:        Private messages on Nerd's Nook, 356-1772 or 356-1872
  18. */
  19.  
  20. /***********************************************************************/
  21. /*        A R C H I V E R     C O M M A N D     D E F I N I T I O N S       */
  22. /***********************************************************************/
  23. /*    To add support for a new unpacker, simply supply a new command
  24.     definition here.  The file name to unpack will be appended to
  25.     the end of the supplied command.  You can customize in more detail
  26.     by modifying the code directly, if need be.
  27. */
  28.  
  29. path = 'c:\utility\'
  30.  
  31. zip_command =        'pkzip'
  32. infozip_command =    'zip -j'
  33. arj_command =        'arj u'
  34. zoo_command =        'zoo u'
  35. lharc_command =     'lha u'
  36. lha_command =        'lha u'
  37. arc_command =        'arc u'
  38.  
  39.  
  40. /***********************************************************************/
  41. /*                    U N Q W K     F I L E N A M E                       */
  42. /***********************************************************************/
  43. /*
  44.     Returns -1 if it the file "archive.id" is bad or non-existent.
  45.     Otherwise, the "archive_id" is returned (1 -> 6).
  46. */
  47.  
  48. parse arg filename msgfile
  49.  
  50. idfile = "archiver.id"
  51.  
  52. if stream(idfile,'c','query exists') = "" then do
  53.     return -1
  54. end
  55.  
  56. archiver_id = linein(idfile,1,1)
  57. status = lineout(idfile)
  58.  
  59. if archiver_id = 1 then archiver_id = 7
  60.  
  61. select                                        /* execute the corresponding command */
  62.     when archiver_id = 1 then path || zip_command filename msgfile
  63.     when archiver_id = 2 then path || arj_command filename msgfile
  64.     when archiver_id = 3 then path || zoo_command filename msgfile
  65.     when archiver_id = 4 then path || lharc_command filename msgfile
  66.     when archiver_id = 5 then path || lha_command filename msgfile
  67.     when archiver_id = 6 then path || arc_command filename msgfile
  68.     when archiver_id = 7 then do
  69.         parse arg filebase"."ext
  70.         path || infozip_command filebase msgfile
  71.         if RC = 0 then do
  72.             'copy' filebase||".zip" filebase||".rep"
  73.         end
  74.         if RC = 0 then do
  75.             'del' filebase||".zip"
  76.         end
  77.     end
  78.     otherwise
  79.         say "UNKNOWN ARCHIVE TYPE: " filename "(" archiver_id ")"
  80.         RC = -1
  81. end
  82.  
  83. if RC <> 0 then return -1
  84.  
  85. return 0
  86.  
  87.